/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package pradoeditor.comun.ui;

import java.awt.BorderLayout;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTree;

/**
 *
 * @author jaimeg
 */
public class IconNodeTreeExample extends JFrame {
  public IconNodeTreeExample() {
    super("IconNode TreeExample");

    List<IconNodeProject> nodes = new ArrayList<IconNodeProject>();

    IconNodeProject nodeTop = new IconNodeProject("top", true, new javax.swing.ImageIcon(getClass().getResource("/pradoeditor/resources/icons/NewProject.png")));

    nodes.add(nodeTop);
    nodeTop.add(new IconNodeProject("dos", true, new javax.swing.ImageIcon(getClass().getResource("/pradoeditor/resources/icons/OpenProject.png"))));
    nodeTop.add(new IconNodeProject("trues", true, new javax.swing.ImageIcon(getClass().getResource("/pradoeditor/resources/icons/OpenProject.png"))));
    nodeTop.add(new IconNodeProject("cuatro",true, null));

    JTree tree = new JTree( nodes.get(0));
    tree.setCellRenderer(new IconNodeRenderer());

    JScrollPane sp = new JScrollPane(tree);
    getContentPane().add(sp, BorderLayout.CENTER);
  }


  public static void main(String args[]) {
    IconNodeTreeExample frame = new IconNodeTreeExample();
    frame.addWindowListener(new WindowAdapter() {
            @Override
      public void windowClosing(WindowEvent e) {System.exit(0);}
    });
    frame.setSize(300, 150);
    frame.setVisible(true);
  }
}

